<?php
/**
 * User: aka
 * Time: 20:58
 */

namespace app\secret\controller;

use think\facade\Session;
use think\Request;

class Article
{
    public function index()
    {
        $condition = array();
        $condition['user_id'] = Session::get('user_info.user_id');
        $condition['state'] = 0;
        $articleList = \app\secret\model\Article::where($condition)
            ->order('id desc')->page(1,6)->select();
        return view('index', ['article_list' => $articleList]);
    }

    public function inputArticle()
    {
        return view('input_article');
    }

    public function article(Request $request)
    {
        $condition = array();
        $condition['user_id'] = Session::get('user_info.user_id');
        $condition['state'] = 0;
        $condition['id'] = base64_decode($request->param('article_id'));
        $article = \app\secret\model\Article::where($condition)->find();
        return view('article', ['article' => $article]);
    }
}